//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.spring.schedule_system.dengxiaojiao.util;

import com.alibaba.fastjson.JSON;
import java.util.HashMap;
import java.util.Map;
import org.springframework.cglib.beans.BeanMap;

public class LyObjectUtil {
    public LyObjectUtil() {
    }

    public static <T, R> R convertTo(T t, Class<R> clz) {
        return LyBeanUtils.copyProperties(t, clz);
    }

    public static <T, R> R convertToByJSON(T t, Class<R> clz) {
        return JSON.parseObject(JSON.toJSONString(t), clz);
    }

    public static Map<String, Object> convertToMap(Object obj) {
        Map<String, Object> map = new HashMap();
        if (null != obj) {
            BeanMap beanMap = BeanMap.create(obj);
            beanMap.forEach((key, value) -> {
                if (null != value) {
                    map.put(String.valueOf(key), value);
                }

            });
        }

        return map;
    }

    public static Map<String, String> convertToMapStr(Object obj) {
        Map<String, String> map = new HashMap();
        if (null != obj) {
            BeanMap beanMap = BeanMap.create(obj);
            beanMap.forEach((key, value) -> {
                if (null != value) {
                    map.put(String.valueOf(key), String.valueOf(value));
                }

            });
        }

        return map;
    }
}
